CN100511154C - Audio driver sound management method - Google Patents

Audio driver sound management method Download PDF

Info

Publication number
CN100511154C
CN100511154C CNB2006101268183A CN200610126818A CN100511154C CN 100511154 C CN100511154 C CN 100511154C CN B2006101268183 A CNB2006101268183 A CN B2006101268183A CN 200610126818 A CN200610126818 A CN 200610126818A CN 100511154 C CN100511154 C CN 100511154C
Authority
CN
China
Prior art keywords
voice data
playlist
sound
management method
priority
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CNB2006101268183A
Other languages
Chinese (zh)
Other versions
CN101140527A (en
Inventor
刘亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
ZTE Corp
Original Assignee
ZTE Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by ZTE Corp filed Critical ZTE Corp
Priority to CNB2006101268183A priority Critical patent/CN100511154C/en
Publication of CN101140527A publication Critical patent/CN101140527A/en
Application granted granted Critical
Publication of CN100511154C publication Critical patent/CN100511154C/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Telephone Function (AREA)
  • Reverberation, Karaoke And Other Acoustics (AREA)

Abstract

The invention relates to a sound management method for audio drive programs to adopt a playing buffer and add an additional playing list; the method comprises the following parallel steps: A) Utilize a playing list to perform real-time record on all kinds of current sound data as well as relevant priority written by application programs; B) Move the corresponding sound data into a playing buffer in the sequence of high-to-low priority; C) Utilize the playing buffer to transmit sound data into an audio device. The method is characterized by adding the playing list into an audio drive program to record a plurality of parallel sound data, selecting to play sound data in higher priority, and further, selecting sound data to be played simultaneously, or played after remembrance, so as to avoid complicated procedure communication, synchronism and large quantity of data transmission work that are caused by program management with a single sound service. Besides, the method adopts an expanded universal standard interface function, so that program transplantation can be relatively simple. Therefore, the method can sufficiently meet sound playing management requirements for mobile phones.

Description

A kind of audio driver sound management method
Technical field
The present invention relates to a kind of sound management method of embedded OS, relate in particular to a kind of sound management method of mobile radio terminal sound intermediate frequency driver.
Background technology
At present, the most typical embedded OS on mobile phone, the PDA terminal is Linux and WinCE.With Linux is example, and general application program plays sound, and calls open () in the (SuSE) Linux OS, ioctl (), write (), read (), close sound interfaces such as () function usually, finishes concrete broadcast by audio driver operating audio equipment.
When audio driver is employed routine call, can in internal memory, create the DMA data buffer,, comprise some buffer cells as Fig. 1.The method that plays sound of existing audio driver as Fig. 2, comprising: 210) beginning; 220) judge whether the DMA data buffer has voice data; Be to change step 230 over to); , do not enter next step; 221) etc. pending data returns step 220); 230) play this voice data; 240) finish.For avoiding control hazard, the open () interface function of this audio driver correspondence specifically as Fig. 3, comprising: 310) beginning; 320) do you judge whether this audio frequency apparatus idle? be to enter next step; , do not change step 331 over to); 330) it is occupied this audio frequency apparatus to be set, and returns success; Change step 340 over to); 331) block or return and make mistakes; 340) finish.Therefore, this audio driver can not be called simultaneously, control by a plurality of application programs, this makes: 1. simple audio frequency apparatus does not allow to be used, play sound separately simultaneously by a plurality of application programs, and back one application program last application program such as has only to use, could use after having closed audio frequency apparatus; Though 2. allow to play simultaneously and record, but do not support to play with recording and take different sampling rates, be that the in progress application program and the application program of recording are interactive, such as, it is 44100 that in progress program is provided with sampling rate, if this moment, recorded program was arranged to 8000 with sampling rate, then our sound heard can become very overcast slow sound, has modified tone.
Typical mobile phone, PDA terminal have numerous scenes when the user uses, such as incoming call, make a phone call in, MP3 play in, come short message, ring in the quarter-bell or the like.These scenes may be concurrent, when therefore cell phone software is developed, must run into Tathagata electric bell sound, keypad tone, quarter-bell sound, short message prompt sound, MP3 music or the like various sound needs to play, and these sound have characteristics separately again: 1. come the electric bell sound, in real time, priority is the highest, no matter what was being done at that time, as long as incoming call is arranged, just must broadcast the prompting of bell sound at once, and can not be interrupted by the centre; 2. the characteristics of keypad tone are often will play simultaneously with other sound, no matter whether playing other sound, a button just should have auditory tone cues; 3. the characteristics of MP3 music are that reproduction time is generally very long, during playing, other a lot of things may take place, and have a lot of other sound to need to play, and in general, the MP3 music should be suspended this moment.Therefore, must preferentially play and play simultaneously.
The problems referred to above can solve like this: 1. increase the sound card hardware device, a plurality of application programs are opened different sound cards simultaneously, but increase the mobile phone terminal cost like this; 2. adopt the audio mixing technology, all sound that will play are carried out audio mixing, this just can separate problem and the interactive problem of playback that must not play simultaneously; Present PC goes up way and just is to use an independent service routine, is responsible for sound card equipment is managed, and various sound are had the queuing of priority, and the sound that priority is high is play earlier.This service routine is all transferred in the operation of sound card finished, other any application should oneself not operated sound card, and other application can only be carried out corresponding operation by method notification service program from message to service routine that send out.The embedded OS that but this method is applied to terminals such as mobile phone, PDA has two distinct disadvantage: (one) this service routine is realized complicated, consider multiple situation: simple bell sound, can directly use filename to do message parameter, call the codec decompress(ion) by service routine, the direct control sound card is play; The MP3 music, because the MP3 player has called the codec decompress(ion), therefore service routine need only directly be write the data of untiing the sound card broadcast, but need to consider that how data are delivered to service routine from media player is a problem, owing to being two different processes and needing data quantity transmitted very big again, so just need mass data transmission mechanism between complicated Inter-Process Communication and synchronization mechanism and process; (2) this method is not easy to transplant existing other handset program, because existing other handset program all is that the direct control sound card plays sound, therefore can conflict with this system, brings very big trouble to transplanting.
Summary of the invention
The technical issues that need to address of the present invention are, how a kind of audio driver sound management method is provided, can realize that on its basis sound according to priority plays, mass data transmission mechanism between complicated Inter-Process Communication and synchronization mechanism and process be can avoid simultaneously, simple mobile radio terminal or intelligent terminal are suitable for; Play when further also can realize multiple sound; Further also but settlement procedure is transplanted problem.
The technology of the present invention problem solves like this, and a kind of audio driver sound management method is provided, and adopts play buffer, it is characterized in that, may further comprise the steps:
A) create a playlist, various current voice data and the priority thereof of utilizing the described audio driver control of described each application call of playlist real time record to write;
B) by described priority order from high to low the described voice data of correspondence is moved to described play buffer.
C) transmit voice data by described play buffer to audio frequency apparatus
Realize on the level of audio driver that like this sound according to priority plays, avoided mass data transmission mechanism between the Inter-Process Communication of the complexity that single sound service routine administrative institute causes and synchronization mechanism and process.This play buffer can be the DMA data buffer.
According to sound management method provided by the invention, in described steps A) in, creating described playlist is to carry out when each application program is opened described audio driver first, and enables described audio frequency apparatus before creating described playlist.
According to sound management method provided by the invention, sound management method is characterized in that, in described steps A) in, when each application program is called audio driver after opening described audio driver first, utilize the mode of described playlist real time record to comprise step:
3.1) judge that audio frequency apparatus has been activated or playlist exists, does judging have in the playlist than the higher voice data of current voice data priority?, do not enter step 3.3); Be to enter next step;
3.2) judge that current voice data can abandon?, do not enter next step; Be to abandon this voice data and enter step 3.4);
3.3) current voice data and priority thereof are appended to described playlist;
3.4) return success.
According to sound management method provided by the invention, in described steps A) in play attribute when also writing down various current voice datas when the various current voice data that writes and priority thereof; At described step B) in the voice data that priority is the highest move to and also comprise after the described play buffer: judge whether have also in the described playlist that to play attribute simultaneously be genuine voice data, be that this voice data stack is moved to described play buffer.
Need the problem of broadcast simultaneously with regard to the further sound that solved like this.
According to sound management method provided by the invention, before voice data is moved or be superimposed to described play buffer, also comprise resampling to described voice data, its sampling rate and channel number are consistent.
According to sound management method provided by the invention, the sampling rate and the channel number of described audio frequency apparatus are made as fixed value.According to sound management method provided by the invention, described sound management method comprises also that some application programs formerly discharge with last and closes the audio driver mode, and wherein last is closed the audio driver mode and comprised: delete this application program corresponding record in described playlist; Judge that described playlist is for empty; Delete this playlist, close audio frequency apparatus; Return success.
According to sound management method provided by the invention, at described step C) also comprise afterwards: described voice data corresponding record in described playlist that deletion is moved; Judge that described playlist is empty, then delete this playlist, close audio frequency apparatus.
According to sound management method provided by the invention, described playlist comprises some records, each record comprise prioritized item, simultaneously play attribute item etc. and with the some one to one voice data buffer cells of described play buffer component units item.
According to sound management method provided by the invention, described playlist can be array, single-track link table or doubly linked list.
A kind of audio driver sound management method provided by the invention, at the inner playlist that increases a plurality of parallel voice datas of record of audio driver, select the voice data of high priority to play during broadcast, further also can select to play again behind the voice data audio mixing of the voice data that need play simultaneously and high priority, this audio driver of types of applications routine call is finished current sound playing on this basis, can avoid the Inter-Process Communication of the complexity that causes by single sound service routine administrative institute, the work synchronous and mass data is transmitted, add the general standard interface function that uses expansion, make program portable simple relatively, fully satisfied mobile phone, PDA terminal sound playing management expectancy.
Description of drawings
Fig. 1 is the DMA buffer zone structural representation that audio driver is created in internal memory.
Fig. 2 is the sound playing schematic flow sheet of common audio driver.
Fig. 3 is the schematic flow sheet of the open () function corresponding with common audio driver.
Fig. 4 is playlist and the DMA buffer zone structural representation that audio driver of the present invention is created in internal memory.
Fig. 5 is the sound playing schematic flow sheet of audio driver of the present invention.
Fig. 6 is the schematic flow sheet of expansion the open () function corresponding with audio driver of the present invention.
Fig. 7 is the schematic flow sheet of expansion the close () function corresponding with audio driver of the present invention.
Embodiment
At first, design philosophy of the present invention is described: at the audio driver layer all sound of total system are carried out unified management, different application or process are directly called this audio driver, realize a plurality of sound playing synchronously and coordinate, do not disturb mutually.
Secondly, key of the present invention is described: at the inner administration module that increases of audio driver, mainly be to increase a playlist, the in progress sound of stored record, structure comprise some SoundRecs as shown in Figure 4, each recording setting has prioritized item, plays attribute item, voice data buffer cell item simultaneously, this voice data buffer cell item is corresponding with the DMA data buffer that audio driver is created, and this playlist also can comprise other, as allowing to suspend item or the like.
This audio driver sound is play management, as shown in Figure 5, specifically comprises following concrete steps:
510) beginning;
520) do you judge that SoundRec is arranged in the playlist?, do not enter step 521); Be to enter step 530);
521) wait for SoundRec, return step 520);
530) search the highest SoundRec of priority; Search the high SoundRec of priority specifically can adopt search, ordering etc.
540) do you judge in the corresponding voice data buffer cell of this SoundRec item that voice data is arranged?, do not enter step 541); Be to enter step 550);
541) wait for voice data, return step 540);
550) this voice data is moved to the DMA buffer zone;
560) do you judge have in the playlist that to play attribute simultaneously be genuine SoundRec?, do not change step 590 over to); Be to enter next step;
570) do you judge in the corresponding voice data buffer cell of this SoundRec item that voice data is arranged?, do not enter step 571); Be to enter step 580);
571) wait for voice data, return step 570);
580) this voice data is moved in the DMA buffer zone with stacked system;
590) data that play sound
Like this, the voice data buffer cell item content of the SoundRec correspondence that audio driver of the present invention is high with the playlist medium priority is transferred to the DMA data buffer; Further, be that the voice data buffer cell item content of genuine SoundRec correspondence is transferred to DMA data buffer and its legacy data audio mixing with playing attribute in the playlist simultaneously, be resent to audio frequency apparatus and play.Assist, audio driver of the present invention is also in step 580) set up audio mixing mechanism, use fixing sampling rate and channel number when promptly opening sound card, the voice data of all other sampling rates is implemented to resample.Such as, the parameter of opening sound card can be set be fixing 44100Hz, two-channel, other any sound that do not conform to all carry out the resampling of software or hardware.
Further, application program calling audio driver of the present invention is described, this calling can have various ways, the principle of optimality is: the standard interface of not changing audio driver, just do suitable expansion, as: these interface names and number of parameters thereof, parameter type, rreturn value are not made any modification, only parameter range is done suitable expansion, can reduce the difficulty of transplanting so to greatest extent.
Concrete, be that example explanation the preferable of audio driver of the present invention calls with (one) expansion open () interface function, (two) expansion close () interface function and (three) expansion ioctl () interface function:
(1) expansion open () interface function is revised return parameters and is made a plurality of application programs open sound card equipment simultaneously, as shown in Figure 6, specifically may further comprise the steps:
610) beginning;
620) do you judge that audio frequency apparatus opens?, do not enter step 630); Be to change step 631 over to); 630) start audio driver, create playlist;
640) current voice data of record and priority thereof, and play attribute simultaneously; Change step 650 over to);
631) do you judge the sound that has priority higher in the playlist?, do not change step 641 over to); Be to enter next step;
Can 632) do you judge that new sound abandon?, do not enter step 641); Be to change step 650 over to);
641) current voice data of record and priority thereof, and play attribute simultaneously;
650) return success;
660) finish.
This expansion open () interface function need be provided with two parameters: numerical priority value i and play attribute Boolean j simultaneously as from the foregoing, this can be provided with by expansion ioctl () interface function, and open () interface function only is provided with default priority numerical value and play the attribute Boolean simultaneously, invoke extensions open () interface function just can use canonical parameter like this, meet general use habit, program portable is simple.
(2) expansion close () interface function is revised its shutoff operation to audio frequency apparatus, only just closes audio frequency apparatus and delete playlist when no any voice data needs to play again, as shown in Figure 7, specifically may further comprise the steps:
710) beginning;
720) the corresponding SoundRec of deletion;
730) do you judge whether also there are other SoundRecs in the playlist?, do not enter next step; Be to change step 760 over to);
740) deletion playlist;
750) audio driver out of service is closed audio frequency apparatus;
760) return success;
770) finish.
(3) expansion ioctl () interface function
Keeping the ioctl function return value, number of parameters under the constant situation of parameter type, increases the function that numerical priority value is set and plays attributes such as attribute Boolean simultaneously.Invoke extensions ioctl () interface function just can use standard format like this, meets general use habit, also meets interface fixing between driver and the application program simultaneously, and program portable is simple.
Some application programs can be simultaneously, staggered or parallel calling expansion open (), ioctl (...), close () and write () interface function can be realized the preferential broadcast of many sound and broadcast simultaneously, wherein expands data rewriting that write () interface function writes former write () interface function play buffer in the playlist in the corresponding record in the space corresponding with play buffer.The method that each application call interface function plays sound specifically can be: invoke extensions open () generates the record space of playlist or playlist; Invoke extensions ioctl (...) writes priority and plays attribute simultaneously in corresponding space; Call write () and write voice data in the corresponding record space; Invoke extensions close (), this application program finishes, and removes to discharge the corresponding record space.
At last, resolve the concrete vocal clash of the present invention with example and handle: audio driver of the present invention is being play current sound, and at this moment the Another Application program is play another sound by expansion interface function request audio driver of the present invention, then:
(1) priority of described another sound of judgement if other SoundRec in current sound of priority ratio and the playlist is all high, is then play new sound, and original sound is ended to play.
(2) priority of described another sound of judgement if other SoundRec in current sound of priority ratio and the playlist is low, if this moment, described another sound can be abandoned, does not then add tabulation with described another sound; If can not be abandoned, then described another sound is added tabulation, by the time higher than its priority sound has finished entirely, then this new sound just can have been play, before playing,, only write the voice data buffer cell item of playlist to the write () request of calling of described another sound, write full back time-out and write, wait for that data are moved into just continuation again of play buffer in the voice data buffer cell item.
(3) if described another sound needs to play immediately, and the sound of current broadcast can not suspend, and can take audio mixing.
In sum, audio driver sound management method of the present invention has been realized the preferential management of many sound and has play simultaneously that the combined standard interface interchange can be transplanted problem by settlement procedure.

Claims (9)

1, a kind of audio driver sound management method adopts play buffer, it is characterized in that, may further comprise the steps:
A) create a playlist, various current voice data and the priority thereof of utilizing the described audio driver control of described each application call of playlist real time record to write;
B) by described priority order from high to low the described voice data of correspondence is moved to described play buffer;
C) transmit described voice data by described play buffer to audio frequency apparatus.
2, sound management method according to claim 1, it is characterized in that, in described steps A) in, creating described playlist is to carry out when each application program is opened described audio driver first, and enables described audio frequency apparatus before creating described playlist.
3, sound management method according to claim 2, it is characterized in that, in described steps A) in, when each application program is called audio driver after opening described audio driver first, utilize the mode of described playlist real time record to comprise step:
3.1) judge that audio frequency apparatus has been activated or playlist exists, does judging have in the playlist than the higher voice data of current voice data priority?, do not enter step 3.3); Be to enter next step;
3.2) judge that current voice data can abandon?, do not enter next step; Be to abandon this voice data and enter step 3.4);
3.3) current voice data and priority thereof are appended to described playlist;
3.4) return success.
4, sound management method according to claim 1 is characterized in that, in described steps A) in play attribute when also comprising the various current voice datas of record when the various current voice data that writes and priority thereof; At described step B) in the voice data that priority is the highest move to and also comprise after the described play buffer: judge that whether also having the described attribute of playing simultaneously in the described playlist is genuine voice data, be that this voice data is moved to described play buffer with stacked system.
5, sound management method according to claim 4, it is characterized in that, described step B) before voice data being moved or move to described play buffer, also comprises resampling, its sampling rate and channel number are consistent described voice data with stacked system.
6, sound management method according to claim 5 is characterized in that, the sampling rate and the channel number of described audio frequency apparatus are made as fixed value.
7, sound management method according to claim 1 is characterized in that, at described step C) also comprise afterwards:
Described voice data corresponding record in described playlist that deletion is moved;
Judge that described playlist is empty, then delete this playlist, close audio frequency apparatus.
8, according to claim 1,2,3,4 or 7 described sound management methods, it is characterized in that, described playlist comprises some records, each record comprise prioritized item, simultaneously play the attribute item and with the some one to one voice data buffer cells of described play buffer component units item.
9, sound management method according to claim 8 is characterized in that, described playlist is array, single-track link table or doubly linked list.
CNB2006101268183A 2006-09-05 2006-09-05 Audio driver sound management method Expired - Fee Related CN100511154C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2006101268183A CN100511154C (en) 2006-09-05 2006-09-05 Audio driver sound management method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2006101268183A CN100511154C (en) 2006-09-05 2006-09-05 Audio driver sound management method

Publications (2)

Publication Number Publication Date
CN101140527A CN101140527A (en) 2008-03-12
CN100511154C true CN100511154C (en) 2009-07-08

Family

ID=39192487

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2006101268183A Expired - Fee Related CN100511154C (en) 2006-09-05 2006-09-05 Audio driver sound management method

Country Status (1)

Country Link
CN (1) CN100511154C (en)

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101266582B (en) * 2008-05-09 2010-04-21 中兴通讯股份有限公司 Embedded equipment audio frequency controller and method
CN101600011B (en) * 2008-06-03 2013-06-05 中兴通讯股份有限公司 Method and device for parallel playing mobile terminal multimedia
CN101626632B (en) * 2008-07-11 2014-07-23 深圳富泰宏精密工业有限公司 Session scheduling device and method of multimedia mobile terminal
CN101339789B (en) * 2008-08-13 2010-08-18 中兴通讯股份有限公司 Implementing method of multimedia engine
CN102033775B (en) * 2009-09-28 2013-03-20 联想(北京)有限公司 Sound management device and method for data processing equipment
CN101697644A (en) * 2009-10-29 2010-04-21 青岛海信移动通信技术股份有限公司 Mixed sound output method and mixed sound output related device of mobile terminal
CN102117221A (en) * 2009-12-31 2011-07-06 上海博泰悦臻电子设备制造有限公司 Audio frequency application conflict management method and manager
CN103809953B (en) 2012-11-14 2018-09-07 腾讯科技(深圳)有限公司 Multimedia monitoring method and system
CN104023305B (en) * 2014-05-30 2015-10-28 爱培科科技开发(深圳)有限公司 A kind of mixing control method of Wince vehicle mounted multimedia and device
CN106325804B (en) * 2015-07-03 2019-05-31 深圳市中兴微电子技术有限公司 Audio-frequency processing method and system
CN109089166B (en) * 2017-06-14 2021-05-14 西安诺瓦星云科技股份有限公司 Program scheduling setting method and device
CN107995369B (en) * 2017-12-19 2021-01-29 广州市千钧网络科技有限公司 Method, device and equipment for solving audio conflict
CN110138484B (en) * 2019-05-27 2020-10-13 安徽商贸职业技术学院 Intelligent campus broadcasting system and method and intelligent classroom applying system
CN111061546A (en) * 2019-10-24 2020-04-24 深圳市元征科技股份有限公司 Power amplifier management method, device, terminal equipment and storage medium

Also Published As

Publication number Publication date
CN101140527A (en) 2008-03-12

Similar Documents

Publication Publication Date Title
CN100511154C (en) Audio driver sound management method
CN101192203A (en) Mobile phones audio frequency playing method
CN1921515B (en) Portable telephone set having content reproduction function and content reproducing method thereof
US10511647B2 (en) Information processing apparatus, information processing method and program
US9218110B2 (en) Information processing apparatus, information processing method, information processing program and recording medium for storing the program
US20070294710A1 (en) Simple bluetooth software development kit
CN101449538A (en) Text to grammar enhancements for media files
JP2009535755A (en) Smart random playback of media objects
US20070188519A1 (en) Information processing apparatus, information processing method, information processing program and recording medium
CN101282375A (en) Method and mobile terminal for mapping multimedia documents based on call record
US20070076534A1 (en) Method of music data transcription
US7668829B2 (en) Method and apparatus for storing music file in mobile communication terminal
CN101339789B (en) Implementing method of multimedia engine
CN102123201A (en) Ringtone shearing method and device of mobile terminal
CN101266582B (en) Embedded equipment audio frequency controller and method
WO2018103420A1 (en) Method and system for storing audio file
US7403605B1 (en) System and method for local replacement of music-on-hold
CN1979464A (en) Method for realizing playing according to request of user in digital media player
CN101515274A (en) Method for reading and playing mobile phone audio-frequency data
KR100703299B1 (en) Apparatus and method for controlling ring tone in mobile terminal having a hard disc drive
KR200299830Y1 (en) Multimedia Apparatus For Combination With Handphone
CN2938656Y (en) Mobile phone system with MP# musical playing function
JP2007251829A (en) Broadcast program editing apparatus, program for broadcast program editing, and portable computer for broadcast program editing
KR20070036241A (en) Method and apparaust for managing service history in mobile commnication set
KR101455194B1 (en) Storing Method and system for the call information of contents shared

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20090708

Termination date: 20170905